package hk.edu.polyu.comp.motioncapture.point;

import java.util.Vector;
import java.util.Iterator;

public class FrameSet {

	private Vector<Frame> optiPlayer;

	public FrameSet() {
		optiPlayer = new Vector<Frame>();
	}

	public FrameSet(int m, int n) {
		optiPlayer = new Vector<Frame>(m, n);
	}

	/**
	 * @deprecated
	 */
	public Vector<Frame> getFrameSet() {
		return optiPlayer;
	}

	public Frame[] getFrameArray() {
		return optiPlayer.toArray(new Frame[0]);
	}

	public boolean add(Frame pts) {
		return optiPlayer.add(pts);
	}

	public int size() {
		return optiPlayer.size();
	}

	public boolean isEmpty() {
		return optiPlayer.isEmpty();
	}

	public Frame first() {
		return optiPlayer.firstElement();
	}

	public Frame last() {
		return optiPlayer.lastElement();
	}

	public Frame frameAt(int index) {
		return optiPlayer.elementAt(index);
	}

	public Iterator<Frame> iterator() {
		return optiPlayer.iterator();
	}

	public void push(Frame frame) {
		optiPlayer.add(frame);
	}

	public Frame pop() {
		Frame frame;
		try {
			frame = optiPlayer.firstElement();
		} catch (Exception e) {
			return null;
		}
		
		optiPlayer.remove(frame);
		return frame;
	}
}
